package com.hjh.thymeleafdemo1.web;

import com.baomidou.mybatisplus.extension.activerecord.Model;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

@Controller
public class HelloController {

    @RequestMapping("/hello")
    public String success(HttpServletRequest request) {
        request.setAttribute("usrName", " 小明");
        return "hello";
    }

    @RequestMapping("/hellos")
    public String hello(HttpServletRequest request) {
        Map<String,Object> map = new HashMap<String, Object>();
        map.put("name","张三");
        map.put("password","123456");
        request.setAttribute("name", " <h2>张三</h2>");
        request.setAttribute("users", Arrays.asList(map));
        return "hello";
    }
}
